package com.wewins.fota.bean.bo.excel.column;

import com.wewins.fota.bean.bo.excel.CellSource;
import com.wewins.fota.bean.bo.excel.Column;
import com.wewins.fota.common.constant.CommonConst;
import com.wewins.fota.common.constant.FotaCode;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.poi.ss.usermodel.CellType;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FotaLogDownloadTypeColumn implements Column {
    private Object value;

    @Builder.Default
    private CellType cellType = CellType.STRING;

    @Override
    public void fillCell(CellSource source) {
        source.getCell().setCellValue(
                ((Integer) this.value) == CommonConst.FOTA_UPDATE_TYPE_HANDLE
                        ? FotaCode.UPDATE_TYPE_HANDLE.getMessage()
                        : FotaCode.UPDATE_TYPE_AUTO.getMessage()
        );
    }
}
